package com.ruoyi.web.controller.drug;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.drug.domain.DrugPhysic;
import com.ruoyi.drug.domain.DrugRecipt;
import com.ruoyi.drug.service.IDrugProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/drug/process")
public class DrugProcessController extends BaseController {
    @Autowired
    private IDrugProcessService drugProcessService;

    @PreAuthorize("@ss.hasPermi('drug:process:list')")
    @GetMapping("/listRecipt")
    public TableDataInfo reciptList(DrugRecipt drugRecipt){
        startPage();
        List<DrugRecipt> list = drugProcessService.selectRecipt(drugRecipt);
        return getDataTable(list);
    }


    @Log(title = "单据审核", businessType = BusinessType.UPDATE)
    @PutMapping("/{ids}")
    public AjaxResult pass(@PathVariable Long[] ids)
    {
        return toAjax(drugProcessService.pass(ids));
    }

    @Log(title = "单据审核", businessType = BusinessType.UPDATE)
    @GetMapping("/{ids}")
    public AjaxResult unpass(@PathVariable Long[] ids)
    {
        return toAjax(drugProcessService.unpass(ids));
    }
}
